package jp.ne.hatena.d.digitalsoul.warikan.cassandra

import org.apache.cassandra.thrift._

object CassandraMutation {

	def createColumnMutation(name:Array[Byte], value:Array[Byte], timestamp:Long):Mutation = {
		val column = new Column(name, value, timestamp)
		val cos = new ColumnOrSuperColumn
		cos.setColumn(column)
		
		val mutation = new Mutation
		mutation.setColumn_or_supercolumn(cos)
		mutation
	}
	
	def createSuperColumnMutation(id:Array[Byte], columns:java.util.List[Column]):Mutation = {
		val superColumn = new SuperColumn(id, columns)
		val cos = new ColumnOrSuperColumn
		cos.setSuper_column(superColumn)
			
		val mutation = new Mutation
		mutation.setColumn_or_supercolumn(cos)
		mutation
	}
	
	
}